<?php if (!defined('SERVER_ROOT')) {exit('No direct script access allowed');}
//header
$this->template->title = 'Danh mục cán bộ';
$this->template->display('dsp_header.php');
$v_MA_DON_VI_filter        = $arr_filter['cbx_MA_DON_VI_filter'];
$v_MA_TO_CHUYEN_MON_filter = $arr_filter['cbx_MA_TO_CHUYEN_MON_filter'];
?>
 <form name="frmMain" id="frmMain" action="" method="POST">
    <?php
    echo $this->hidden('controller',$this->get_controller_url());
    echo $this->hidden('hdn_item_id','0');
    echo $this->hidden('hdn_item_id_list','');
    echo $this->hidden('hdn_dsp_single_method','dsp_single_canbo');
    echo $this->hidden('hdn_dsp_all_method','dsp_all_canbo');
    echo $this->hidden('hdn_update_method','update_canbo');
    echo $this->hidden('hdn_delete_method','delete_canbo');
    echo $this->hidden('hdn_TYPE_filter', 'MA_DON_VI');
    $v_row = 0;

    ?>
   <div id="div_filter">
        <label>Đơn vị</label>
        <select id="cbx_MA_DON_VI_filter"
                name="cbx_MA_DON_VI_filter"
                onchange="cbx_MA_DON_VI_filter_onchange(this)"
                >
                  <?php while ($arr = $arr_all_donvi_filter->FetchRow()): ?>
                  <?php
                   $MA=$arr['MA_DON_VI'];
                   $TEN=$arr['TEN_DON_VI'];
                  ?>
                   <?php if($v_MA_DON_VI_filter == $MA):?>
                     <option value="<?php echo $MA; ?>" selected="selected"><?php echo $TEN; ?></option>
                  <?php else:?>
                     <option value="<?php echo $MA; ?>" ><?php echo $TEN; ?></option>
                  <?php endif ?>
                <?php endwhile; ?>
        </select>
        <label>Tổ/bộ môn</label>
        <select id="cbx_MA_TO_CHUYEN_MON_filter"
                name="cbx_MA_TO_CHUYEN_MON_filter"
                onchange="cbx_MA_TO_CHUYEN_MON_filter_onchange(this);"
                >
                  <?php while ($arr = $arr_all_tochuyenmon_filter->FetchRow()): ?>
                  <?php
                   $MA=$arr['MA_TO_CHUYEN_MON'];
                   $TEN=$arr['TEN_TO_CHUYEN_MON'];
                  ?>
                   <?php if($v_MA_TO_CHUYEN_MON_filter == $MA):?>
                     <option value="<?php echo $MA; ?>" selected="selected"><?php echo $TEN; ?></option>
                  <?php else:?>
                     <option value="<?php echo $MA; ?>" ><?php echo $TEN; ?></option>
                  <?php endif ?>
                <?php endwhile; ?>
        </select>
        <input class = 'button' type="button" name="btn_add_canbo" value="Thêm cán bộ" onclick="location.href='<?php echo SITE_ROOT . 'qlcb/canbo/dsp_single_canbo/&m=0'?>'"/>
        <input type="button" name="update" class = 'button ' value="Danh sách cán bộ chưa phân nơi công tác" onclick="location.href='<?php echo SITE_ROOT . 'qlcb/canbo/dsp_canbo_chuaphancongtac'?>'"/>
<!--        <input class = 'button' type="button" name="btn_add_canbo" value="Cán bộ chưa phân nơi công tác" onclick="location.href='<?php echo SITE_ROOT . 'qlcb/canbo/dsp_canbo_chuaphancongtac'?>'"/>
-->
	</div>

    <table  width="100%" class="adminlist" cellspacing="0" border="1">
        <colgroup>
            <col width="36%" />
            <col width="20%" />
            <col width="6%" />
            <col width="8%" />
            <col width="30%" />
        </colgroup>
        <tr>
            <th>Tên cán bộ</th>
            <th>Chức vụ</th>
            <th>Thứ tự</th>
            <th>Trạng thái</th>
            <th>Thao tác</th>
        </tr>
         <?php while ($arr = $arr_all_canbo->FetchRow()): ?>
           <?php
               $ALL_TR=$arr['ALL_TR'];
               $TONG_SO_DONG=$arr['TONG_SO_DONG'];
               echo $arr['ALL_TR'];?>
           <?php endwhile; ?>
        <?php echo $this->add_empty_rows($TONG_SO_DONG, _CONST_DEFAULT_ROWS_PER_PAGE, 5);?>
    </table>

</form>
<script>
    function themnoicongtac_onclick(macanbo) {
          var url = '<?php echo $this->get_controller_url(); ?>dsp_themnoicongtac/' + macanbo
          url += '/?&macanbo=' + macanbo + '&pop_win=1';
          showPopWin(url, 450, 220, null);
      }
    function cbx_MA_DON_VI_filter_onchange(e){
       var f = document.frmMain;
       f.hdn_TYPE_filter.value =  'MA_DON_VI';
       f.submit();
    }
    function cbx_MA_TO_CHUYEN_MON_filter_onchange(e){
       var f = document.frmMain;
       f.hdn_TYPE_filter.value =  'MA_TO_CHUYEN_MON';
       f.submit();
    }

    function qtct_canbo_click(macanbo){
        var url = '<?php echo $this->get_controller_url();?>dsp_all_to_of_canbo/' + macanbo
            url += '/?&macanbo=' + macanbo + '&pop_win=1';
        showPopWin(url ,700,350, null);
    }
    function phanquyen_canbo_click(macanbo,tencanbo){
        var url = '<?php echo $this->get_controller_url();?>dsp_all_nhomquyen/'  + macanbo
            url += '/?&tencanbo=' + tencanbo + '&hdn_item_id=' + macanbo + '&pop_win=1' + '&hdn_item_name=' + tencanbo;
        showPopWin(url ,420,350, null);
    }
    function quick_delete_canbo(macanbo)
    {
        var f = document.frmMain;
        if (confirm('Bạn chắc chắn xoá đối tượng đã chọn?')){
            f.hdn_item_id.value =  macanbo;
            m = $("#controller").val() + 'delete_canbo'
            $("#frmMain").attr("action", m);
            f.submit();
        }
    }

</script>
<?php $this->template->display('dsp_footer.php');